<?php
class doom_factory_model {

    public static $_modelInstances = array();
    
    public function getModel($type, $key, $extData = null) {

        $clazz = 'model_' . join('_', explode('.', $type));

        $model = new $clazz();
        $model->setKey($key);
        $model->setExtData($extData);
        $model->computeTableName();

        $dbClazz = $model->getDbEngine();
        $db = new $dbClazz($model->getDbConfig());

        $model->setDb($db);

        return $model;
    }
}